package cn.bmyi.apiautotest.common;

import org.apache.log4j.Level;

/**
 * 封装log4j
 * 
 * @author 毛建杰
 *
 */
public class Logger
{

	/**
	 * 记录info日志
	 * 
	 * @param message
	 *            日志内容
	 */
	public static void info(Object message)
	{
		StackTraceElement stack[] = (new Throwable()).getStackTrace();
		org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(stack[1].getClassName());
		logger.log(Logger.class.getName(), Level.INFO, message, null);
	}

	/**
	 * 记录error日志
	 * 
	 * @param message
	 *            日志内容
	 */
	public static void error(Object message)
	{
		StackTraceElement stack[] = (new Throwable()).getStackTrace();
		org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(stack[1].getClassName());
		logger.log(Logger.class.getName(), Level.ERROR, message, null);
	}

	/**
	 * 记录debug日志
	 * 
	 * @param message
	 *            日志内容
	 */
	public static void debug(Object message)
	{
		StackTraceElement stack[] = (new Throwable()).getStackTrace();
		org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(stack[1].getClassName());
		logger.log(Logger.class.getName(), Level.DEBUG, message, null);
	}
}
